package Controller;


import Model.Emp1;
import Service.ServiceImpl.EmpService;

import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Scanner;

public class UserController {
    public static int num;
    private static Integer empId = 1;

    public void UserServiceRequset() throws SQLException, IOException {
            EmpService empService = new EmpService();
            boolean flag = true;
            while (flag) {
                System.out.println("--------请选择你要操作的业务--------");
                System.out.println("1.新增房源");
                System.out.println("2.查找房屋");
                System.out.println("3.删除房屋");
                System.out.println("4.修改房屋信息");
                System.out.println("5.房屋列表");
                System.out.println("6.退出");
                Scanner scanner = new Scanner(System.in);
                int menu = scanner.nextInt();
                switch (menu) {
                    case 1:
                        HashMap hashMap = new HashMap();
                        System.out.println("姓名");
                        String name = scanner.next();
                        hashMap.put("name",name);

                        System.out.println("电话");
                        String tel = scanner.next();
                        hashMap.put("tel",tel);

                        System.out.println("地址");
                        String dress = scanner.next();
                        hashMap.put("dress",dress);

                        System.out.println("月租");
                        Integer money = scanner.nextInt();
                        hashMap.put("money",money);

                        System.out.println("状态");
                        String sta = scanner.next();
                        hashMap.put("sta",sta);
                        //System.out.println("UserController.num = " + UserController.num);
                        empService.addEmp(hashMap);

                        break;

                    case 2:
                        empService.showEmp();
                        break;
                    case 3:
                        System.out.println("请输入你要删除的房屋");
                        Integer empId = scanner.nextInt();
                        empService.delEmp(empId);
                    case 4:
                        System.out.println("请输入要修改的房屋信息");
                        Integer empId1 = scanner.nextInt();
                        empService.updateEmp(empId1);
                        break;
                    case 5:
                        empService.showEmp();
                        break;
                    case 6:
                        System.out.println("6.再见");
                        flag = false;
                        break;
                }

            }
        }
    }